﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Text;
using InfoSoftGlobal;

public partial class ZHCX_NZBTJB : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!Page.IsPostBack)
    {
      if (!ProjectPrivate.GetQX("26"))
      {
        Server.Transfer("~\\blank.aspx");
      }
      DataSet ds = CBSJ.GetYear();
      CommonUse.BindDDL(ds, "year", "year", DateTime.Now.Year.ToString(), ddlYear);
    }
    KHS();
    YJF();
    YJQL();
    YSF();
  }

  protected void KHS()
  {
    lbXSKHS.Text = KHXX.GetXSKH();
    lbYJF.Text = CBSJ.GetYJF(ddlYear.SelectedValue);
    lbWJF.Text = (Convert.ToDouble(lbXSKHS.Text) - Convert.ToDouble(lbYJF.Text)).ToString();
    StringBuilder strXML = new StringBuilder();
    strXML.Append("<graph caption='线上客户数' showNames='1' baseFont='宋体' baseFontSize='12' subCaption='' decimalPrecision='0' numberSuffix='' pieSliceDepth='30' formatNumberScale='0'>");

    strXML.Append("<set name='已计费' value='" + lbYJF.Text + "' />");
    strXML.Append("<set name='未计费' value='" + lbWJF.Text + "' />");
    strXML.Append("</graph>");
    ltKHS.Text = FusionCharts.RenderChartHTML("../FCF/Pie2D.swf", "", strXML.ToString(), "myNext", "500", "200", false);
  }
  protected void YJF()
  {
    lbJFYJF.Text = JFSJ.GetJFYJF(ddlYear.SelectedValue);
    lbJFWJF.Text = (Convert.ToDouble(lbYJF.Text) - Convert.ToDouble(lbJFYJF.Text)).ToString();
    StringBuilder strXML = new StringBuilder();
    strXML.Append("<graph caption='已计费客户数' showNames='1' baseFont='宋体' baseFontSize='12' subCaption='' decimalPrecision='0' numberSuffix='' pieSliceDepth='30' formatNumberScale='0'>");

    strXML.Append("<set name='已缴费' value='" + lbJFYJF.Text + "' />");
    strXML.Append("<set name='未缴费' value='" + lbJFWJF.Text + "' />");
    strXML.Append("</graph>");
    ltYJF.Text = FusionCharts.RenderChartHTML("../FCF/Pie2D.swf", "", strXML.ToString(), "myNext", "500", "200", false);
  }
  protected void YJQL()
  {
    lbYJQL.Text = CBSJ.GetYJQL(ddlYear.SelectedValue);
    StringBuilder strXML = new StringBuilder();
    strXML.Append("<graph caption='已计气量'bgColor ='#CCFFCC'showBorder='1' showNames='1' baseFont='宋体' baseFontSize='12' subCaption='' decimalPrecision='0' numberSuffix='' pieSliceDepth='30' formatNumberScale='0'>");
    DataTable dt = CBSJ.GetYJQL_FZ(ddlYear.SelectedValue);
    for (int i = 0; i < dt.Rows.Count; i++)
    {
      strXML.Append("<set name='" + dt.Rows[i]["yqxz"].ToString() + "' value='" + dt.Rows[i]["a"].ToString() + "' />");
    }
    strXML.Append("</graph>");
    ltYJQL.Text = FusionCharts.RenderChartHTML("../FCF/Pie3D.swf", "", strXML.ToString(), "myNext", "500", "200", false);
  }
  protected void YSF()
  {
    lbYSF.Text = CBSJ.GetYSF(ddlYear.SelectedValue);
    lbYISF.Text = JFSJ.GetYISF(ddlYear.SelectedValue);
    double xzqf = Convert.ToDouble(lbYSF.Text) - Convert.ToDouble(lbYISF.Text);
    xzqf = xzqf < 0 ? 0 : xzqf;
    xzqf = Math.Round(xzqf, 2);
    lbXZQF.Text = xzqf.ToString();
    StringBuilder strXML = new StringBuilder();
    strXML.Append("<graph caption='应收费'bgColor ='#CCFFCC'showBorder='1' showNames='1' baseFont='宋体' baseFontSize='12' subCaption='' decimalPrecision='0' numberSuffix='' pieSliceDepth='30' formatNumberScale='0'>");

    strXML.Append("<set name='已收费' value='" + lbYISF.Text + "' />");
    strXML.Append("<set name='欠费' value='" + lbXZQF.Text + "' />");
    strXML.Append("</graph>");
    ltYSF.Text = FusionCharts.RenderChartHTML("../FCF/Pie3D.swf", "", strXML.ToString(), "myNext", "500", "200", false);
  }
  protected void btnQuery_Click(object sender, EventArgs e)
  {

  }
}